#include "StdAfx.h"
#include "TrackData.h"
#include "AP_AtomExtracts.h"
using namespace m4aSharp;
using namespace System::Text;

TrackData::TrackData(TrackInfo* track)
{
	encoder_name = (gcnew String(track->encoder_name))->Trim('\0');
	track_hdlr_name = (gcnew String(track->track_hdlr_name))->Trim('\0');

	array<Byte>^ lang = gcnew array<Byte>(4);
	lang[0] = track->unpacked_lang[0];
	lang[1] = track->unpacked_lang[1];
	lang[2] = track->unpacked_lang[2];
	lang[3] = track->unpacked_lang[3];
	unpacked_lang = Encoding::ASCII->GetString(lang)->Trim('\0');	

	creation_time = track->creation_time;
	modified_time = track->modified_time;
	duration = track->duration;
	track_enabled = track->track_enabled;		
	track_type = track->track_type;
	track_codec = track->track_codec;
	protected_codec = track->protected_codec;		
	contains_esds = track->contains_esds;		
	section3_length = track->section3_length;
	section4_length = track->section4_length;
	ObjectTypeIndication = track->ObjectTypeIndication;
	max_bitrate = track->max_bitrate;
	avg_bitrate = track->avg_bitrate;
	section5_length = track->section5_length;
	descriptor_object_typeID = track->descriptor_object_typeID;
	channels = track->channels;
	m4v_profile = track->m4v_profile;
	avc_version = track->avc_version;
	profile = track->profile;
	level = track->level;
	video_height = track->video_height;
	video_width = track->video_width;
	macroblocks = track->macroblocks;
	sample_aggregate = track->sample_aggregate;
	amr_modes = track->amr_modes;
	type_of_track = track->type_of_track;	
}
